package service;

import java.util.*;

import beans.*;
import db.*;


public class ksService {
	
	public List<ksBean> browse(){
		ksDAO dao =new ksDAO();
		return dao.getAllRecords();
	}
	
	public boolean addks(ksBean ks)
	{
		ksDAO ksDao=new ksDAO();
		return ksDao.insertRecord(ks);
	}
	
	public ksBean getRecord(String ksId)
	{
		ksDAO ksDao=new ksDAO();
		return ksDao.getRecord(ksId);
	}
	public ksBean getRecord1(String name)
	{
		ksDAO ksDao=new ksDAO();
		return ksDao.getRecord1(name);
	}
	
	public int delks(ksBean ks)
	{
		ksDAO ksDao=new ksDAO();
		if(ksDao.deleteRecord(ks))
			return 1;
		else
			return 2;
	}
	
	public int updateks(ksBean beforeRecord,ksBean afterRecord)
	{
		ksDAO ksDao=new ksDAO();
		if(ksDao.updateRecord(beforeRecord,afterRecord))
			return 1;
		else
			return 2;
	}
}
